package com.szpx.controller.twoGroup;


import com.szpx.entity.settingentity.PriceSetting;
import com.szpx.entity.settingentity.SiteSetting;
import com.szpx.service.PriceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/price")
public class PriceController {
    @Autowired
    private PriceService priceService;

    /**
     * 查询所有站点数据
     * @param model
     */
    @GetMapping
    public List<PriceSetting> selectALl(Model model){
        List<PriceSetting> priceSettings = priceService.selectAll();
        model.addAttribute("List",priceSettings);
        return priceSettings;
    }
    @PostMapping("/add")
    public String   add(@RequestBody PriceSetting priceSettings){
        priceService.add(priceSettings);
        return "新增成功";
    }
    @PostMapping("/delete/{id}")
    public String delete(@PathVariable(value = "id") Integer id){
        priceService.delete(id);
        return "删除成功";
    }
    @PostMapping("/updete/{id}")
    public String update(@RequestBody PriceSetting priceSetting){
        priceService.update(priceSetting);
        return "修改成功";
    }


}
